/*
 * @Descripttion: 
 * @Author: ziwei
 * @Date: 2022-05-15 17:10:14
 * @LastEditors: ziwei
 * @LastEditTime: 2022-05-15 21:06:53
 */
// index.js
var _app = require("../../npm/app.js");
class Index extends _app.Component {
  constructor() {
    super();
    this.state = {
      count: 0
    };
  }
  componentDidMount() {
    console.log('执行componentDidMount');
    this.setState({
      count: 1
    });
  }
  onAddClick() {
    this.setState({
      count: this.state.count + 1
    });
  }
  onReduceClick() {
    this.setState({
      count: this.state.count - 1
    });
  }
  createData() {
    this.__state = arguments[0];
    console.log("this.__state",this.__state);
    const text = this.state.count % 2 === 0 ? '偶数' : '奇数';
    Object.assign(this.__state, {
      text: text
    });
    return this.__state;
  }
}

Index.$$events = ['onAddClick','onReduceClick']
Page(require('../../npm/app.js').createPage(Index))
